// eslint-disable-next-line no-undef
const { defineConfig } = require("@vue/cli-service");
// eslint-disable-next-line no-undef
const TerserPlugin = require("terser-webpack-plugin");
// eslint-disable-next-line no-undef
module.exports = defineConfig({
  publicPath: process.env.NODE_ENV === "production" ? "/business-service/" : "/",
  transpileDependencies: true,
  devServer: {
    port: 8089,
    client: {
      overlay: {
        warnings: false,
        errors: true
      }
    },
    headers: {
      "Access-Control-Allow-Origin": "*"
    },
    proxy: {
      "/prod-api": {
        // eslint-disable-next-line no-undef
        target: process.env.VUE_APP_BASE_URL,
        changeOrigin: true,
        pathRewrite: {
          "^/prod-api": ""
        }
      },
      "/dev-api": {
        // eslint-disable-next-line no-undef
        target: process.env.VUE_APP_BASE_URL,
        changeOrigin: true,
        pathRewrite: {
          "^/dev-api": ""
        }
      }
    }
  },
  configureWebpack: {
    optimization: {
      minimizer: [
        new TerserPlugin({
          terserOptions: {
            compress: {
              drop_console: true,
              drop_debugger: true
            }
          }
        })
      ]
    }
  }
});
